Skip to content

Extract rule: template-attribute-indentation#2461

Merged
NullVoxPopuli merged 2 commits intoember-cli:masterfrom
NullVoxPopuli:nvp/template-lint-extract-rule-template-attribute-indentation
Mar 13, 2026
Merged

Extract rule: template-attribute-indentation#2461
NullVoxPopuli merged 2 commits intoember-cli:masterfrom
NullVoxPopuli:nvp/template-lint-extract-rule-template-attribute-indentation

Conversation

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

Split from #2371.

@NullVoxPopuli NullVoxPopuli force-pushed the nvp/template-lint-extract-rule-template-attribute-indentation branch from eebc45d to 95b425f Compare March 6, 2026 21:04
Non-block form (> 80 characters):

```hbs
{{employee-details firstName=firstName lastName=lastName age=age avatarUrl=avatarUrl}}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be updated to angle bracket invocation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in a different PR perhaps -- these are copying from ember-template-lint.

I'd rather get everything ported over from #2371, and then do full modernization passes, rather than doing the same small loop on repeat


## Rule Details

This rule requires the positional params, attributes, and block params of helpers/components to be indented by moving them to multiple lines when the open invocation has more than 80 characters (configurable).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be hbs only since this is the kind of stylistic thing that should be prettier for template tags?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be a stylisstic rule, yes (never in the recommended config), but not everyone uses prettier, so I imagine once all of #2371 is merged, we make sure this rule works with gjs

@NullVoxPopuli NullVoxPopuli force-pushed the nvp/template-lint-extract-rule-template-attribute-indentation branch 2 times, most recently from d41ba4f to 8c7a593 Compare March 10, 2026 22:22
@johanrd
Copy link
Copy Markdown
Contributor

johanrd commented Mar 12, 2026

Missing validateClosingTag

The original validates that closing tags (</div>) are properly aligned via validateClosingTag (lines 438-468), called from the ElementNode visitor when the element has children (lines 592-598):

if (node.children.length) {
  const lastChild = node.children.at(-1);
  const expectedStartLine =
    lastChild.type === 'BlockStatement'
      ? lastChild.loc.end.line + 1
      : lastChild.loc.end.line;
  this.validateClosingTag(node, expectedStartLine);
}

The PR has no equivalent — GlimmerElementNode only validates attribute indentation and the opening tag's close bracket, but never checks the closing position. There's also no corresponding messageId for the error. This means misaligned closing tags like:

  <div
    class="foo"
  >
    content
      </div>

...would not be caught.

@NullVoxPopuli NullVoxPopuli force-pushed the nvp/template-lint-extract-rule-template-attribute-indentation branch from 8c7a593 to cab476d Compare March 13, 2026 00:09
@NullVoxPopuli NullVoxPopuli merged commit f12f142 into ember-cli:master Mar 13, 2026
9 checks passed
@NullVoxPopuli NullVoxPopuli deleted the nvp/template-lint-extract-rule-template-attribute-indentation branch March 13, 2026 00:26
NullVoxPopuli added a commit that referenced this pull request Mar 14, 2026
Post-merge review of #2461 (`template-attribute-indentation`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants